﻿using System.Windows.Controls;
using ParseControls;

namespace ParseOnlineAdmin
{
    /// <summary>
    /// Interaction logic for ParseRelatedPropertyItemView.xaml
    /// </summary>
    public partial class ParseRelatedPropertyItemView : UserControl
    {
        private string _Property = string.Empty;

        // ctr 
        public ParseRelatedPropertyItemView(string property)
        {
            InitializeComponent();

            _Property = property;
        }
        public ParseRelatedPropertyItemView()
        {
            InitializeComponent();
        }

        // overrides 
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (this._Property != string.Empty)
            {
                this.lblProperty.Text = this._Property;

                try
                {
                    BindingHelper.BindPropertyThis(this.txtValue, TextBox.TextProperty,
                                        "SelectedItem",
                                        new ParseObjectToStringConverter(), this._Property);
                }
                catch (System.Exception ex)
                {

                }
            }
        }
    }
}
